<template>
  <div>
    <div class="head">
      <p class="text">分类</p>
      <van-icon
        @click="onClickLeft()"
        size="20"
        color="whitesmoke"
        name="arrow-left"
        class="icon"
      />
    </div>
    <div>
      <van-tabs
        background="#6c90f3"
        title-inactive-color="white"
        class="index_tab van_tab"
        v-model="active"
        @click="onClick"
        sticky
      >
        <van-tab title="应用分类" title-style="font-size:20px">
          <br />
          <div
          @click.stop="jumpSoftShow(item,index)"
            class="guess_like_show"
            v-for="(item, index) in softList"
            :key="index"
          >
            <van-image
              radius="10"
              class="guess_like_img"
              width="50"
              height="50"
              :src="item.app_image_road"
            />
              <van-icon class="soft_arrow" name="arrow" />

            <span class="guess_like_sp1">{{ item.app_type_name }}</span>
          </div>
        </van-tab>
        <van-tab title="游戏分类" title-style="font-size:20px">
          <br />
            <div
            @click.stop="jumpSoftShow(item,index)"
              class="guess_like_show"
              v-for="(item, index) in gameList"
              :key="index"
            >
              <van-image
                radius="10"
                class="guess_like_img"
                width="50"
                height="50"
                :src="item.app_image_road"
              />
              <van-icon class="soft_arrow" name="arrow" />
              <span class="guess_like_sp1">{{ item.app_type_name }}</span>
            </div>
        </van-tab>
      </van-tabs>
    </div>
  </div>
</template>
<script>
import http from '../api/index';
export default {
  data() {
    return {
      softList: [],
      gameList: [],
      active: parseInt(this.$route.params.id) - 1,
    };
  },
  methods: {
    // 
    jumpSoftShow(item,index){
      this.$router.push('/softShow/'+item.app_type_id)
    },
    onClick(name, title) {
      console.log(name);
    },
    onClickLeft() {
      this.$router.push('/softGame');
    },
  },
  mounted() {
    http
      .getSoftKind({
        app_father_type_id: 1,
      })
      .then((r) => {
        console.log(r);
        this.softList = r.data;
      });
    http
      .getSoftKind({
        app_father_type_id: 2,
      })
      .then((r) => {
        console.log(r);
        this.gameList = r.data;
      });
  },
};
</script>
<style scoped>
.head {
  width: 100%;
  height: 4rem;
  background-color: rgb(108, 144, 243);
}
.text {
  text-align: center;
  font-size: 1.6rem;
  color: whitesmoke;
  line-height: 4rem;
}
.icon {
  position: absolute;
  top: 1.1rem;
  /* left: 0px; */
}
.guess_like {
  width: 96%;
  margin: 0 auto;
  border-radius: 1.5rem;
  background-color: white;
}
.guess_text {
  position: relative;
}
.guess_text_sp1 {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  font-size: 1.6rem;
}
.soft_arrow {
  position: absolute;
  right: 1rem;
  top: 2.6rem;
  font-size: 2rem;
}
.guess_like_show {
  background-color: white;
  margin: 0 auto;
  border-radius: 1.5rem;
  width: 96%;
  height: 7rem;
  position: relative;
  margin-top: 2rem;
}
.guess_like_img {
  position: absolute;
  top: 1rem;
  left: 2rem;
  border-radius: 1rem;
}
.guess_like_sp1 {
  position: absolute;
  top: 2rem;
  left: 8.5rem;
  font-size: 2rem;
  color: #252525;
}
.guess_like_sp2 {
  position: absolute;
  top: 3rem;
  left: 8.5rem;
  font-size: 1.4rem;
  color: #7a7a7a;
}
.guess_like_small {
  position: absolute;
  top: 0.8rem;
  right: 0px;
  width: 7rem;
}
</style>